/*
 * MapObject.h
 *
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses 
 */

#ifndef MAPOBJECT_H_
#define MAPOBJECT_H_

#include <string>
#include "Identifiable.h"
#include "Positionable.h"
#include "Observable.h"
#include "Clonable.h"
#include "Representable.h"
#include "SharedConstants.h"

using std::string;

// Clase base para los objetos del mapa

class MapObject: virtual public Identifiable,
                 virtual public Positionable,
                 virtual public Observable,
                 virtual public Clonable,
                 virtual public Representable {
protected:
    int resistance;
    int alignment;
    int points;
    bool entered;
    string typeXml;

public:
    MapObject(int x, int y);
    MapObject(int id, int x, int y);
    MapObject(int x, int y, string typeXml);
    MapObject(int id, int x, int y, string typeXml);
    int getResistance();
    int getAlignment();
    int getPoints();
    bool hasEnteredTheMap();
    void setEnteredTheMap(bool entered_the_map);
    // Notifica OBJECT_DESTROYED si el objeto es destruido por el daño recibido
    virtual void receiveDamage(int damage, MapObject* from = 0);
    virtual void destroy();
    virtual bool isDestroyed();
    // Los objetos devuelven false si la colisión se resuelve a favor del
    // colisionado (o sea, si el objeto colisionante no puede ocupar el lugar
    // del colisionado) y true en caso contrario
    virtual bool collideWith(MapObject* object);
    virtual bool getCollidedBy(MapObject* object);
    virtual MapObject* clone();
    // Devuelve la representación del objeto
    virtual ModelObject getRepresentation();
    virtual ~MapObject();
    void setTypeXml(string typeXml);
    string getTypeXml();
private:
    void init(int x, int y);
};

#endif /* MAPOBJECT_H_ */
